// i.d(t, { fp: () => s, m8: () => r })
import Logger from "./Logger"
const n = new Logger("util-browser"),
  getItem = function (key: string, defaultVal: any) {
    if (!("localStorage" in window)) return defaultVal
    let i
    try {
      i = window.localStorage.getItem(key)
    } catch (e) {
      n.debug(e)
      return defaultVal
    }
    return null === i ? defaultVal : "boolean" == typeof defaultVal ? "true" === i : "number" == typeof defaultVal ? parseFloat(i) : i
  },
  setItem = function (key: string, val: any) {
    try {
      window.localStorage.setItem(key, val)
    } catch (e) {
      n.error(e)
    }
  }
export default {
  getItem,
  setItem
}
